package com.quasar.hpatient.view.adapter;

import android.content.Context;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.quasar.hpatient.R;
import com.quasar.hpatient.model.custommodel.PharmedData;

import java.util.List;

/**
 * name : lishuai
 * time : 2017/11/18
 * title:
 */

public class PharmeDataAdapter extends BaseMultiItemQuickAdapter<PharmedData, BaseViewHolder> {

    public PharmeDataAdapter(Context context, List data) {
        super(data);
        addItemType(PharmedData.TITLE, R.layout.pharme_title);
        addItemType(PharmedData.EDIT, R.layout.pharme_edit);
        addItemType(PharmedData.FROM, R.layout.pharme_from);
    }

    @Override
    protected void convert(BaseViewHolder helper, PharmedData item) {

        switch (helper.getItemViewType()) {
            case PharmedData.TITLE:

                if (item != null) {
                    helper.setText(R.id.at_tv_time, item.getTime());
                }
                break;
            case PharmedData.EDIT:
                if (item != null) {
                    helper.setText(R.id.ad_tv_content, item.getPharmedItemData().getContent());
                }
                break;
            case PharmedData.FROM:
                if (item != null) {
                    helper.setText(R.id.pharmacy_tv_edittext, item.getFromcontent());
                }
                break;

        }

    }
}
